class MyCalendarModel {
  int? errcode;
  String? errmsg;
  List<MyCalendarItemModel>? data;
  String? message;

  MyCalendarModel({this.errcode, this.errmsg, this.data, this.message});

  MyCalendarModel.fromJson(Map<String, dynamic> json) {
    errcode = json['errcode'];
    errmsg = json['errmsg'];
    if (json['data'] != null) {
      data = <MyCalendarItemModel>[];
      json['data'].forEach((v) {
        data!.add(new MyCalendarItemModel.fromJson(v));
      });
    }
    message = json['message'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['errcode'] = this.errcode;
    data['errmsg'] = this.errmsg;
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    data['message'] = this.message;
    return data;
  }
}

class MyCalendarItemModel {
  int? id;
  String? name;
  String? description;
  int? userId;
  String? userName;
  List<Tags>? tags;
  List<User>? user;
  String? location;
  String? start;
  String? stop;
  String? startDate;
  String? stopDate;

  List? date;
  String? state;
  bool? isFocus;

  MyCalendarItemModel(
      {this.id,
        this.name,
        this.description,
        this.userId,
        this.userName,
        this.tags,
        this.user,
        this.location,
        this.start,
        this.stop,
        this.startDate,
        this.stopDate,
        this.date,
        this.state,
        this.isFocus});

  MyCalendarItemModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    description = json['description'];
    userId = json['user_id'];
    userName = json['user_name'];
    if (json['tags'] != null) {
      tags = <Tags>[];
      json['tags'].forEach((v) {
        tags!.add(new Tags.fromJson(v));
      });
    }
    if (json['user'] != null) {
      user = <User>[];
      json['user'].forEach((v) {
        user!.add(new User.fromJson(v));
      });
    }
    location = json['location'];
    start = json['start'];
    stop = json['stop'];
    startDate = json['start_date'];
    stopDate = json['stop_date'];
    date = json['date'];
    state = json['state'];
    isFocus = json['is_focus'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['description'] = this.description;
    data['user_id'] = this.userId;
    data['user_name'] = this.userName;
    if (this.tags != null) {
      data['tags'] = this.tags!.map((v) => v.toJson()).toList();
    }
    if (this.user != null) {
      data['user'] = this.user!.map((v) => v.toJson()).toList();
    }
    data['location'] = this.location;
    data['start'] = this.start;
    data['stop'] = this.stop;
    data['start_date'] = this.startDate;
    data['stop_date'] = this.stopDate;
    data['date'] = this.date;
    data['state'] = this.state;
    data['is_focus'] = this.isFocus;
    return data;
  }
}

class Tags {
  int? id;
  String? name;

  Tags({this.id, this.name});

  Tags.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }
}


class User {
  int? id;
  String? name;

  User({this.id, this.name});

  User.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }
}
